/*
 *  Copyright 2019-2020 Zheng Jie
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package com.fzhucc.modules.activity.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.sql.Timestamp;

/**
 * @author yyg
 * @website https://eladmin.vip
 * @description /
 * @date 2022-11-17
 **/
@Entity
@Data
@Table(name = "tt_activity")
public class Activity implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "id")
    private Integer id;

    @Column(name = "`title`", nullable = false)
    @NotBlank
    @ApiModelProperty(value = "标题")
    private String title;

    @Column(name = "`banner`")
    @ApiModelProperty(value = "banner图片")
    private String banner;

    @Column(name = "`release_time`")
    @ApiModelProperty(value = "发布时间")
    private Timestamp releaseTime;

    @Column(name = "`activity_start_time`", nullable = false)
    @ApiModelProperty(value = "活动开始时间")
    private Timestamp activityStartTime;

    @Column(name = "`activity_end_time`", nullable = false)
    @ApiModelProperty(value = "活动结束时间")
    private Timestamp activityEndTime;

    @Column(name = "`sort`", nullable = false)
    @ApiModelProperty(value = "排序")
    private Integer sort;

    @Column(name = "`sponsor`")
    @ApiModelProperty(value = "主办方")
    private String sponsor;

    @Column(name = "`intro`")
    @ApiModelProperty(value = "简介")
    private String intro;

    @Column(name = "`content`")
    @ApiModelProperty(value = "内容")
    private String content;

    @Column(name = "`is_show`", nullable = false)
    @NotNull
    @ApiModelProperty(value = "是否展示小程序 默认展示")
    private Integer isShow;

    @Column(name = "`sign_up_time`")
    @ApiModelProperty(value = "报名开始时间")
    private Timestamp signUpTime;

    @Column(name = "`sign_end_time`")
    @ApiModelProperty(value = "报名结束时间")
    private Timestamp signEndTime;

    @Column(name = "`address`")
    @ApiModelProperty(value = "活动地址")
    private String address;

    @Column(name = "`review`")
    @ApiModelProperty(value = "活动回顾")
    private String review;

    @Column(name = "`is_show_sign`", nullable = false)
    @NotNull
    @ApiModelProperty(value = "是否展示报名按钮 默认不展示")
    private Integer isShowSign;

    @Column(name = "`is_delete`", nullable = false)
    @NotNull
    @ApiModelProperty(value = "是否假删除默认0 (0-否,1-是)")
    private Integer isDelete;

    @Column(name = "`direct`")
    @ApiModelProperty(value = "主办")
    private String direct;

    @Column(name = "`undertake`")
    @ApiModelProperty(value = "承办")
    private String undertake;

    @Column(name = "`jointly_direct`")
    @ApiModelProperty(value = "协办")
    private String jointlyDirect;

    @Column(name = "`sustain`")
    @ApiModelProperty(value = "支持")
    private String sustain;

    @Column(name = "`guide`")
    @ApiModelProperty(value = "指导")
    private String guide;

    @Column(name = "`executing_unit`")
    @ApiModelProperty(value = "执行单位")
    private String executingUnit;

    @ApiModelProperty(value = "地区划分 即什么地区看的到什么地区的数据,省的看到全部")
    @Column(name = "`org_area`",nullable = false)
    @NotNull
    public String orgArea;

    @Column(name = "`hot`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "热度")
    private Integer hot;


    public void copy(Activity source) {
        BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
